import requests
from lxml import etree

url = 'https://s.weibo.com/top/summary'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko'}

html_response = requests.get(url, headers=headers)
html_content = html_response.content.decode('utf8')
print(html_content)

html = etree.HTML(html_content)
hot_search_s = html.xpath('//tr[position()>1]')
hot_search_list = []
for hot_search in hot_search_s:
    hot_search_dict = {}
    title = hot_search.xpath('.//td[@class="td-02"]/a/text()')[0]
    hot_url = hot_search.xpath('.//td[@class="td-02"]/a/@href')[0]
    hot = hot_search.xpath('.//td[@class="td-02"]/span/text()')[0]
    hot_search_dict = {
        'title': title,
        'hot': hot,
        'hot_url': hot_url
    }
    hot_search_list.append(hot_search_dict)
for temp_hot_search in hot_search_list:
    print(temp_hot_search)
